<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="getSession.jsp" %>
<%
	request.setCharacterEncoding("utf-8");

	String name = request.getParameter("classname");
	
	DBHelper helper = new DBHelper();
	
	String sql="insert into classinfo (classname) values (?)";
	
	int i = helper.executeInsert(sql, name);
	
	helper.close();
	if(i>0){
		%>
		<script type="text/javascript">
		alert("添加成功");
		window.location.href="class_list.jsp"
		</script>
		<%
	}else{
		%>
		<script type="text/javascript">
		alert("添加失败");
		window.location.href="add_class.jsp"
		</script>
		<%
	}

%>